package com.zhongxi.guoyuan.entity.shopcart;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * Created by Administrator on 2017/2/18.
 */

public class Address implements Serializable{

    private String id;
    private String username;
    private String mphone;
    private String province;
    private String pid;
    private String city;
    private String cid;
    private String prefecture;
    private String preid;
    private String address;
    private String isdefault;
    private boolean isflag;

    public boolean isflag() {
        return isflag;
    }

    public void setIsflag(boolean isflag) {
        this.isflag = isflag;
    }

    public Address(boolean isflag) {
        this.isflag = isflag;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getMphone() {
        return mphone;
    }

    public void setMphone(String mphone) {
        this.mphone = mphone;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCid() {
        return cid;
    }

    public void setCid(String cid) {
        this.cid = cid;
    }

    public String getPrefecture() {
        return prefecture;
    }

    public void setPrefecture(String prefecture) {
        this.prefecture = prefecture;
    }

    public String getPreid() {
        return preid;
    }

    public void setPreid(String preid) {
        this.preid = preid;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getIsdefault() {
        return isdefault;
    }

    public void setIsdefault(String isdefault) {
        this.isdefault = isdefault;
    }

    public static Address parseMatch(JSONObject obj){
        Address add = new Address(true);
        try{
            add.setId(obj.getString("id"));
            add.setUsername(obj.getString("username"));
            add.setMphone(obj.getString("mphone"));
            add.setProvince(obj.getString("province"));
            add.setPid(obj.getString("pid"));
            add.setCity(obj.getString("city"));
            add.setCid(obj.getString("cid"));
            add.setPrefecture(obj.getString("prefecture"));
            add.setPreid(obj.getString("preid"));
            add.setAddress(obj.getString("address"));
            add.setIsdefault(obj.getString("isdefault"));
        }catch (Exception e){
            e.printStackTrace();
        }
        return add;
    }
}
